//
//  ZSY_AllEuropeCollectionViewCell.m
//  ZSY_BreadTrip
//
//  Created by 张诗宇 on 16/1/4.
//  Copyright © 2016年 张诗宇. All rights reserved.
//

#import "ZSY_MoreListCollectionViewCell.h"

@interface ZSY_MoreListCollectionViewCell ()

@property (nonatomic, retain) ZSY_BaseImageView *coverImageView;
@property (nonatomic, retain) ZSY_BaseLabel *nameLabel;

@end

@implementation ZSY_MoreListCollectionViewCell

- (void)dealloc {
    [_model release];
    [_coverImageView release];
    [_nameLabel release];
    [super dealloc];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)setModel:(ZSY_DestinationModel *)model {
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
//    NSLog(@"name = %@", _model.name);
    self.nameLabel.text = _model.name_orig;
    self.nameLabel.textColor = [UIColor whiteColor];
    
    NSURL *url = [NSURL URLWithString:_model.cover];
    [self.coverImageView sd_setImageWithURL:url placeholderImage:nil];
    
    
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews {
//    self.contentView.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:243 / 255.0 blue:233 / 255.0 alpha:1];;
    
    self.coverImageView = [[ZSY_BaseImageView alloc] initWithFrame:CGRectMake(0, 0, (WIDTH - 30) / 2, 180)];
    //    self.coverImageView.backgroundColor = [UIColor blackColor];
    self.coverImageView.layer.cornerRadius = 5;
    self.coverImageView.layer.masksToBounds = YES;
    self.coverImageView.layer.borderWidth = 1;
    self.coverImageView.layer.borderColor = [UIColor lightGrayColor].CGColor;

    [self.contentView addSubview:_coverImageView];
    
    self.nameLabel = [[ZSY_BaseLabel alloc] initWithFrame:CGRectMake(10, 150, 100, 20)];
    //    self.nameLabel.backgroundColor = [UIColor lightGrayColor];
    [self.coverImageView addSubview:_nameLabel];
    
}


@end
